const fp = require('lodash/fp')
const _ = require('lodash')
const cars = require('./cars.json')

// 使用flowRight 写一个sanitizeNames函数，返回一个下划线连接的小写字符串
//
let _underscore = fp.replace(/\W+/g, '_')

const trace = _.curry((tag, v) => {
  console.log(tag, v)
  return v
})

let sanitizeNames = fp.flowRight(fp.map(fp.flowRight(_underscore,trace('00'),fp.toLower,fp.prop('name'))))
console.log(sanitizeNames(cars))
